<layout name='layout' />

<div class="admin-main">

	<blockquote class="layui-elem-quote">
		<button class="layui-btn layui-btn-small" id="dbBtn">
			<i class="fa fa-database"></i> 备份数据库
		</button>

		<button class="layui-btn layui-btn-small layui-btn-danger" id="delBtn">
			<i class="fa fa-close"></i> 删除
		</button>

	</blockquote>

	<fieldset class="layui-elem-field">
		<legend>数据列表</legend>
		<div class="layui-field-box">
			<form id="ajaxForm" method="post" action="<{:U('Db/del')}>">
			<table class="site-table table-hover">
				<thead>
					<tr>
						<th><input type="checkbox" id="selected-all"></th>								
						<th>文件名</th>
						<th>备份时间</th>
						<th>文件大小</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					<volist name="list" id="vo">
					<tr>
						<td><input type="checkbox" name="f[]" value="<{$vo.name}>"></td>
						<td><{$vo.name}></td>
				        <td><{$vo.createTime}></td>
				        <td><{$vo.size}></td>
						<td>	
							<a href="<{:U('Db/down' , array('File'=>$vo['name']))}>" class="layui-btn layui-btn-mini" target="_blank">下载</a>						
							<a href="<{:U('Db/restore' , array('File'=>$vo['name']))}>" class="layui-btn layui-btn-mini" onClick="return confirm('确定将数据库还原到当前备份吗？');">还原</a>
						</td>
					</tr>	
					</volist>						
				</tbody>
			</table>
			</form>
		</div>
	</fieldset>
</div>
<script>
$("#dbBtn").click(function(){
	$('#ajaxForm').attr('action', '<{:U('Db/backup')}>');
	$('#ajaxForm').submit();
});
</script>